@extends('admin.base')
    @section('content')
        <!-- Content Header (Page header) -->
        <section class="content-header">
          <h1>
            信息输出表
            <small>preview of simple tables</small>
          </h1>
          <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
            <li><a href="#">用户信息</a></li>
            <li class="active">列表</li>
          </ol>
        </section>

        <!-- Main content -->
        <section class="content">
          <div class="row">
            <div class="col-md-12">
              <div class="box">
                <div class="box-header with-border">
                  <h3 class="box-title"><i class="fa fa-th"></i> 用户信息管理</h3>
                </div><!-- /.box-header -->
                <div class="box-body">
                  <table class="table table-bordered text-center">
                    <tr>
                      <th style="width:60px">用户名</th>
                      <th>邮箱</th>
                      <th>密码</th>
                      <th>权限</th>
                      <th>密保问题</th>
                      <th>密保答案</th>
                      <th>操作</th>
                    </tr>
                    @foreach($list as $v)
                    <tr>
                      <td>{{$v->userName}}</td>
                      <td>{{$v->email}}</td>
                      <td>{{$v->password}}</td>
                      <!--<td>{{ $v->status == "0" ? "普通用户" : "管理员" }}</td>-->
					  <td>
						@if($v->status == 1)
							冻结 | <a href="{{url('admin/user/jdong/')}}/{{$v->id}}"><button class="btn btn-xs btn-info">解冻</button></a>
						@elseif($v->status == 0)
							正常 | <a href="{{url('admin/user/dong/')}}/{{$v->id}}"><button class="btn btn-xs btn-info">冻结</button></a>
						@endif
					  </td>
                      <td>{{$v->question}}</td>
                      <td>{{$v->answer}}</td>
                      <td>
                      <button onclick="doEdit({{$v->id}})" class="btn btn-xs btn-primary">编辑</button> 
                      <button onclick="doShow({{$v->id}})" class="btn btn-xs btn-success">用户详情</button> 
                      <button onclick="doAddress({{$v->id}})" class="btn btn-xs btn-info">收货地址详情</button> 
					  <button onclick="doDel({{$v->id}})" class="btn btn-xs btn-danger">删除</button> 
					  </td>
                    </tr>
                    @endforeach
                  
                   
                  </table>
                </div><!-- /.box-body -->
                <div class="box-footer clearfix">
                 {!! $list->render() !!}
                </div>
              </div><!-- /.box -->

              
              
            </div><!-- /.col -->
            
          </div><!-- /.row -->
         
        </section><!-- /.content -->
        <form action="" style="display:none;" id="myeditform" method="get">
        </form>
        <form action="" style="display:none;" id="myshowform" method="get">
        </form>
		<form action="" style="display:none;" id="myaddressform" method="get">
        </form>
        <form action="" style="display:none;" id="mydeleteform" method="post">
            <input type="hidden" name="_token" value="<?php echo csrf_token(); ?>">
            <input type="hidden" name="_method" value="DELETE">
        </form>
    @endsection
    
    
    @section("myscript")
      <script type="text/javascript">
           
			function doEdit(id){
				$("#myeditform").attr("action","{{url('admin/user')}}/"+id+"/edit").submit(); 
			}
			
			function doShow(id){
				$("#myshowform").attr("action","{{url('admin/user')}}/"+id).submit(); 
			}
			
			function doAddress(id){
				$("#myaddressform").attr("action","{{url('admin/address')}}/"+id).submit();
			}
			
			function doDel(id){
                if(confirm('确定要删除吗？')){
                    $("#mydeleteform").attr("action","{{url('admin/user')}}/"+id).submit(); 
                }
            }
			
      </script>
    @endsection